jQuery(document).ready(function() {
	//创建JQGRID表格
	
	//var grid = 
		$("#table1").ligerGrid({
        columns: [
                  { display: 'id', name: 'id', hide:true, width:1 },
                  { display: '等级', name: 'zdStep', hide:true },
                  { display: '销售单号', name: 'zd001FormCode', width: 150 },
                  { display: 'PI编号', name: 'zd002PiCode', width: 180},
                  { display: '客户单位名称', name: 'zd006CustomerName', width: 200},
                  { display: '单据状态', name: 'zd024Billstatus', width: 80,
                	  render: function (item){               		 
                		  var billStatus=item.zd024Billstatus;
                		  if(billStatus=="PCSR_SAVE"){
                			  return "<span style='color:red;'>草稿</span>";
                		  }
                		  if(billStatus=="PCSR_BACK"){
                			  return "<span style='color:red;'>驳回</span>";
                		  }
                		  if(billStatus=="PCSR_SUBMIT"){
                			  return "<span style='color:red;'>待财务审核</span>";
                		  }
                		  if(billStatus=="PCSR_AUDIT"){
                			  return "<span style='color:red;'>待生产审核</span>";
                		  }
                		  if(billStatus=="PCSR_APPROVE"){
                			  return "<span style='color:red;'>待生产</span>";
                		  }
                		  if(billStatus=="PCSR_IN"){
                			  return "<span style='color:red;'>生产中</span>";
                		  }
                		  if(billStatus=="PCSR_END"){
                			  return "<span style='color:red;'>生产完成</span>";
                		  }
                	  }
                  },
                  { display: '仓库状态', name: 'zd025WareStatus', width: 70,
                    	  render: function (item){               		 
                    		  var status=item.zd025WareStatus;
                    		  if(status=="0"||status==null){
                    			  return "<span style='color:red;'>未出库</span>";
                    		  }
                    		  if(status=="1"){
                    			  return "<span style='color:red;'>部分出库</span>";
                    		  }
                    		  if(status=="2"){
                    			  return "<span style='color:red;'>全部出库</span>";
                    		  }
                    	  }
                  },
                  { display: '业务员', name: 'zd022SalesMan', width: 100 },
                  { display: '制单人', name: 'bizCreatorName', width: 100 },
                  { display: '建单时间', name: 'bizCreatorDate', width: 100,
                	  render: function (item){
                		  var cdate=new Date(item.bizCreatorDate);
                		  return formatDate(cdate,"yyyy-MM-dd");
                	  }},
                  { display: '备注', name: 'zd023Remark', width: 150 }
                 ],  
                      usePager: true,pageSize:15,pageSizeOptions :[10,15,20,30,40,50], 
                      enabledSort:false,
                      url : basic_Url+"/backList.do",
                      width: "100%", height:"98%", checkbox: true, rownumbers:true,     
                      onDblClickRow : function (data, rowindex, rowobj){
                    	  edittype(data);
                      }
     });
	$("#pageloading").hide();
});

